package spike;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.support.SpringBootServletInitializer;

import javax.servlet.ServletException;

/**
 * Created by ylyang on 29/03/2017.
 */
@SpringBootApplication
@EnableAutoConfiguration
public class MainApplication extends SpringBootServletInitializer implements CommandLineRunner {
    private Logger logger = Logger.getLogger(MainApplication.class);


    @Value("${application.properties.name}")
    private String propertiesName;

    public static void main(String[] args) throws ServletException {
        SpringApplication springApplication = new SpringApplication(MainApplication.class);
        springApplication.setWebEnvironment(true);
        springApplication.run(args);
    }

    @Override
    public void run(String... strings) throws Exception {
        logger.info("*****************************************");
        logger.info("START TO RUN MIGRATION SPRING APPLICATION");
        logger.info("USE PROPERTY: " + propertiesName);
        logger.info("*****************************************");
    }

}
